# Maintainer: Angel Velasquez <angvp@archlinux.org> 
# Contributor: Stéphane Gaudreault <stephane@archlinux.org>

pkgname=serf
pkgver=1.3.10
pkgrel=1
pkgdesc="High-performance asynchronous HTTP client library"
arch=('loong64' 'x86_64')
url="https://serf.apache.org"
license=('Apache')
depends=('apr-util')
makedepends=('scons')
source=(https://www.apache.org/dist/serf/${pkgname}-${pkgver}.tar.bz2{,.asc}
        openssl3-ERR_GET_FUNC.patch)
validpgpkeys=('C236283C970D2C3CFEEB4936BF35CF0078383142'
              'E7B2A7F4EC28BE9FF8B38BA4B64FFF1209F9FA74')
sha256sums=('be81ef08baa2516ecda76a77adf7def7bc3227eeb578b9a33b45f7b41dc064e6'
            'SKIP'
            '15026f5ce219d2222dbdb6dcbb8911f3c8fbe0cedf3a2ec2ff434dde8d7fb9be')

prepare() {
  cd $pkgname-$pkgver
  patch -p1 -i ../openssl3-ERR_GET_FUNC.patch
}

build() {
  cd ${pkgname}-${pkgver}
  scons CFLAGS="${CFLAGS}" \
        LINKFLAGS="${LDFLAGS}" \
        PREFIX=/usr GSSAPI=/usr/bin/krb5-config
}

check() {
  cd ${pkgname}-${pkgver}
  # Runs into infinite loop
  #scons check
}

package() {
  cd ${pkgname}-${pkgver}
  install -d "${pkgdir}/usr"
  scons install --install-sandbox="${pkgdir}"
}
